package solved;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.PriorityQueue;

/*
ID:		liluyan1
LANG:	JAVA
TASK:	humble
*/
public class humble {
	public static void main(String[] args) throws IOException {
		BufferedReader f = new BufferedReader(new FileReader("humble.in"));
		PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(
				"humble.out")));
		new humble().solve(f, out);
		out.close();
		System.exit(0);
	}
	
	private void solve(BufferedReader f, PrintWriter out) throws IOException {
		int[] a = read(f, 2);
		int K = a[0];
		int N = a[1];
		int[] p = read(f, K);
		Arrays.sort(p);
		
		PriorityQueue<Number> queue = new PriorityQueue<Number>();
		int max = 0;
		for (int i=0; i<K; i++) {
			max = Math.max(max, p[i]);
			queue.add(new Number(p[i], i));
		}
		
		for (int i=0; i<N-1; i++) {
			Number n = queue.remove();
			for (int j=n.base; j<K; j++) {
				if (Integer.MAX_VALUE/p[j] <= n.value) break;
				int t = n.value * p[j];
				if (queue.size() > N && t > max) break;
				max = Math.max(max, t);
				queue.add(new Number(t, j));
			}
		}
		
		out.println(queue.remove().value);
	}
	
	private class Number implements Comparable {
		int value;
		int base;
		
		public Number(int value, int base) {
			this.value = value;
			this.base = base;
		}
		
		public int compareTo(Object n) {
			return value - ((Number)n).value;
		}
	}
	
	public int read(BufferedReader f) throws IOException {
		return Integer.parseInt(f.readLine());
	}
	
	public int[] read(BufferedReader f, int N) throws IOException {
		String[] t = f.readLine().split(" ");
		int[] a = new int[N];
		for (int i=0; i<N; i++) {
			a[i] = Integer.parseInt(t[i]);
		}
		return a;
	}
}
